﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OracleClient;
using BCNPCObject.DB;
using DbLinq;
using DbLinq.Oracle;
using CMISLibrary.Entities;
using CMISLibrary;

namespace BCNPCObject
{
    public class cls_CN_BB_GTHU_Controller
    {
        #region   Atributes

        private DataSet CMIS_Header = new CMISOutputParameter();
        private DataSet ds = new DataSet();
        private DataTable dt = new DataTable();
        private CN_BB_GTHU info;

        #endregion

        #region   Constructor

        public cls_CN_BB_GTHU_Controller()
        {
            info = new CN_BB_GTHU();
        }
        public cls_CN_BB_GTHU_Controller(CN_BB_GTHU Info)
        {
            this.info = Info;
        }

        #endregion

        #region   Properties

        public CN_BB_GTHU pInfor
        {
            get { return info; }
            set { info = value; }
        }

        #endregion

        #region  DungNT NPC

        public long GetSequence(ref string str)
        {
            try
            {
                long _sobbangiao = CMIS2.DB.ExecuteCommand("select SEQ_CN_BBGTHU_GIAO.nextval from dual", ref str);
                if (str.Trim().Length > 0) return -1;
                return _sobbangiao;
            }
            catch
            {
                //CMIS2.ResetDB(); 
                return -1;
            }
        }

        public bool insert_CN_BB_GTHU()
        {
            try
            {

                CN_BB_GTHU objCN_BB_GTHU = new CN_BB_GTHU()
                {
                    MA_CNANG = info.MA_CNANG,
                    MA_DVIQLY = info.MA_DVIQLY,
                    MA_NVIEN = info.MA_NVIEN,
                    MA_TNGAN = info.MA_TNGAN,
                    NGAY_GIAO = info.NGAY_GIAO,
                    NGAY_QTOAN = info.NGAY_QTOAN,
                    NGAY_SUA = info.NGAY_SUA,
                    NGAY_TAO = info.NGAY_TAO,
                    NGUOI_SUA = info.NGUOI_SUA,
                    NGUOI_TAO = info.NGUOI_TAO,
                    SO_BBGIAO = info.SO_BBGIAO,
                    SO_BBQTOAN = info.SO_BBQTOAN,
                    TSO_GTGT = info.TSO_GTGT,
                    TSO_GTGTQT = info.TSO_GTGTQT,
                    TSO_HDON = info.TSO_HDON,
                    TSO_HDONQT = info.TSO_HDONQT,
                    TSO_TIEN = info.TSO_TIEN,
                    TSO_TIENQT = info.TSO_TIENQT,
                    LOAI_BBAN = info.LOAI_BBAN
                };
                CMIS2.DB.CN_BB_GTHU.InsertOnSubmit(objCN_BB_GTHU);
                return true;
            }
            catch
            {
                return false;
            }
        }
        #endregion
     
    }
}

